/**
 * 
 */
package repository.relsys.app;

import java.io.FileInputStream;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;

import java.util.Map;

import javax.ws.rs.core.MediaType;

import org.apache.log4j.Logger;

import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.FileManager;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;

import repository.relsys.config.Property;
import repository.relsys.domainmodel.general.Resource;
import repository.relsys.domainmodel.ltool.interfaces.AudioCreation;
import repository.relsys.domainmodel.ltool.interfaces.Blog;
import repository.relsys.domainmodel.ltool.interfaces.CollaborativeTagging;
import repository.relsys.domainmodel.ltool.interfaces.ContactList;
import repository.relsys.domainmodel.ltool.interfaces.EducationalFeature;
import repository.relsys.domainmodel.ltool.interfaces.Feature;
import repository.relsys.domainmodel.ltool.interfaces.FileSharing;
import repository.relsys.domainmodel.ltool.interfaces.GeneralInformation;
import repository.relsys.domainmodel.ltool.interfaces.InstantMessaging;
import repository.relsys.domainmodel.ltool.interfaces.LearningTool;
import repository.relsys.domainmodel.ltool.interfaces.MicroBlog;
import repository.relsys.domainmodel.ltool.interfaces.MobileDevice;
import repository.relsys.domainmodel.ltool.interfaces.MultimediaHosting;
import repository.relsys.domainmodel.ltool.interfaces.OnlineConferencing;
import repository.relsys.domainmodel.ltool.interfaces.OperetingSystem;
import repository.relsys.domainmodel.ltool.interfaces.PresentationCreation;
import repository.relsys.domainmodel.ltool.interfaces.RssFeed;
import repository.relsys.domainmodel.ltool.interfaces.SiteSearch;
import repository.relsys.domainmodel.ltool.interfaces.SocialBookmarking;
import repository.relsys.domainmodel.ltool.interfaces.SocialNetworking;
import repository.relsys.domainmodel.ltool.interfaces.TechnicalInformation;
import repository.relsys.domainmodel.ltool.interfaces.ToolAvailability;
import repository.relsys.domainmodel.ltool.interfaces.ToolCost;
import repository.relsys.domainmodel.ltool.interfaces.UserGroup;
import repository.relsys.domainmodel.ltool.interfaces.UserProfileManagement;
import repository.relsys.domainmodel.ltool.interfaces.Voip;
import repository.relsys.domainmodel.ltool.interfaces.Wiki;
import repository.relsys.domainmodel.ltool.pojos.LearningToolCls;
import repository.relsys.domainmodel.ltool.pojos.MobileDeviceCls;
import repository.relsys.domainmodel.ltool.pojos.OperetingSystemCls;
import repository.relsys.domainmodel.ltool.pojos.ToolAvailabilityCls;
import repository.relsys.domainmodel.ltool.pojos.ToolCostCls;

import repository.relsys.services.DataModelManager;

import repository.relsys.services.RelsysReadWrite;
import repository.relsys.services.datacentral.FileDataProvider;
import repository.relsys.services.spring.RelsysResourceFactory;
import repository.relsys.util.json.JSONExporter;
import repository.relsys.util.json.JSONExporterCls;
import thewebsemantic.RDF2Bean;

public class RelsysRun {

	private static Logger logger = Logger.getLogger(RelsysRun.class.getName());

	public static void main(String[] args) {
		try {

			Settings.getInstance();
			RelsysRun.initRepository();
			logger.info("Repository initialised!");

			System.in.read();

			DataModelManager.getInstance().flush();

		} catch (Exception e) {
			logger.error(e.getMessage());
		}
	}

	public static void initRepository() throws Exception {

		RelsysReadWrite rrw = new RelsysReadWrite();

		Collection<LearningTool> ltools = new LinkedList<LearningTool>();

		RelsysResourceFactory rf = new RelsysResourceFactory();

		LearningTool ltool1 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool1.setTitle("WordPress");
		ltool1
				.setToolImgURL("http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Wordpress-logo.png/250px-Wordpress-logo.png");

		GeneralInformation gi1 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi1
				.setDescription("WordPress is an open source blogging platform that is free and easy to use.");
		gi1.setToolURL("http://www.wordpress.com");

		ToolCost toolcost = (ToolCost) rf.createResource(ToolCost.class);
		toolcost.setTitle("Free");

		ToolAvailability ta = (ToolAvailability) rf
				.createResource(ToolAvailability.class);
		ta.setTitle("Hosted");
		ToolAvailability ta2 = (ToolAvailability) rf
				.createResource(ToolAvailability.class);
		ta2.setTitle("Download");

		gi1.setToolCost(toolcost);
		gi1.setToolAvailability(ta);

		ltool1.setGeneralInfo(gi1);

		TechnicalInformation ti1 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti1.registration(false);
		ti1.setLaunchedTime("2001");

		ti1.isOpenSource(true);

		MobileDevice mdCls1 = (MobileDevice) rf
				.createResource(MobileDevice.class);
		mdCls1.setTitle("Blackberry");

		MobileDevice mdCls2 = (MobileDevice) rf
				.createResource(MobileDevice.class);
		mdCls2.setTitle("IPhone");
		MobileDevice mdCls3 = (MobileDevice) rf
				.createResource(MobileDevice.class);
		mdCls3.setTitle("Andorid");
		MobileDevice mdCls4 = (MobileDevice) rf
				.createResource(MobileDevice.class);
		mdCls4.setTitle("None");
		ti1.addMD(mdCls1);
		ti1.addMD(mdCls2);
		ti1.addMD(mdCls3);

		OperetingSystem os1 = (OperetingSystem) rf
				.createResource(OperetingSystem.class);
		os1.setTitle("Linux");
		OperetingSystem os2 = (OperetingSystem) rf
				.createResource(OperetingSystem.class);
		os2.setTitle("Windows");
		OperetingSystem os3 = (OperetingSystem) rf
				.createResource(OperetingSystem.class);
		os3.setTitle("MacOS");

		ti1.addOS(os1);
		ti1.addOS(os2);
		ti1.addOS(os3);

		ltool1.setTechnicalInfo(ti1);

		Collection<Feature> features = new LinkedList<Feature>();
		Blog blog = (Blog) rf.createResource(Blog.class);
		ContactList folowers = (ContactList) rf
				.createResource(ContactList.class);
		blog.setTitle("Blog");
		folowers.setTitle("ContactList");
		features.add(blog);
		features.add(folowers);

		ltool1.setFeatures(features);

		LearningTool ltool2 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool2.setTitle("Facebook");
		ltool2
				.setToolImgURL("http://upload.wikimedia.org/wikipedia/commons/thumb/0/06/Facebook.svg/230px-Facebook.svg.png");

		GeneralInformation gi2 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi2
				.setDescription("Facebook is a leading social networking site with over 300 million members. There are now many Facebook applications that allow it be used productively in education and business");
		gi2.setToolURL("http://www.facebook.com");
		gi2.setToolCost(toolcost);
		gi2.setToolAvailability(ta);

		ltool2.setGeneralInfo(gi2);

		TechnicalInformation ti2 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti2.registration(true);
		ti2.setLaunchedTime("2005");

		ti2.isOpenSource(true);

		ti2.addMD(mdCls1);
		ti2.addMD(mdCls2);
		ti2.addMD(mdCls3);

		ti2.addOS(os1);
		ti2.addOS(os2);
		ti2.addOS(os3);

		ltool2.setTechnicalInfo(ti2);

		Collection<Feature> facefeatures = new LinkedList<Feature>();
		UserProfileManagement upm = (UserProfileManagement) rf
				.createResource(UserProfileManagement.class);
		SocialNetworking sn = (SocialNetworking) rf
				.createResource(SocialNetworking.class);
		SiteSearch ss = (SiteSearch) rf.createResource(SiteSearch.class);
		MultimediaHosting mh = (MultimediaHosting) rf
				.createResource(MultimediaHosting.class);
		InstantMessaging im = (InstantMessaging) rf
				.createResource(InstantMessaging.class);
		CollaborativeTagging ct = (CollaborativeTagging) rf
				.createResource(CollaborativeTagging.class);

		upm.setTitle("UserProfileManagement");
		sn.setTitle("SocialNetworking");
		ss.setTitle("SiteSearch");
		mh.setTitle("MultimediaHosting");
		im.setTitle("InstantMessaging");
		ct.setTitle("CollaborativeTagging");

		facefeatures.add(upm);
		facefeatures.add(sn);
		facefeatures.add(ss);
		facefeatures.add(mh);
		facefeatures.add(im);
		facefeatures.add(ct);
		ltool2.setFeatures(facefeatures);

		LearningTool ltool3 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool3.setTitle("Elgg");
		ltool3.setToolImgURL("http://elgg.org/images/elgg.png");

		GeneralInformation gi3 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi3
				.setDescription("Elgg is open source software that combines a number of social media tools - blogging, wikis, micro-blogging, file upload and sharing, RSS feeds, social bookmarking and social networking - for personal and group use- all on one platform");
		gi3.setToolURL("http://www.elgg.com");
		gi3.setToolCost(toolcost);
		gi3.setToolAvailability(ta2);

		ltool3.setGeneralInfo(gi3);

		TechnicalInformation ti3 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti3.registration(true);
		ti3.setLaunchedTime("2008");

		ti3.isOpenSource(true);

		ti3.addMD(mdCls4);

		ti3.addOS(os1);
		ti3.addOS(os2);
		ti3.addOS(os3);

		ltool3.setTechnicalInfo(ti3);

		Collection<Feature> features3 = new LinkedList<Feature>();
		Blog blog3 = (Blog) rf.createResource(Blog.class);
		SocialNetworking sn3 = (SocialNetworking) rf
				.createResource(SocialNetworking.class);
		SiteSearch ss3 = (SiteSearch) rf.createResource(SiteSearch.class);
		SocialBookmarking sb3 = (SocialBookmarking) rf
				.createResource(SocialBookmarking.class);
		RssFeed rss = (RssFeed) rf.createResource(RssFeed.class);
		Wiki wiki = (Wiki) rf.createResource(Wiki.class);
		FileSharing fs = (FileSharing) rf.createResource(FileSharing.class);
		MicroBlog mb = (MicroBlog) rf.createResource(MicroBlog.class);

		mb.setTitle("MicroBlog");
		fs.setTitle("FileSharing");
		wiki.setTitle("Wiki");
		rss.setTitle("RssFeed");
		sb3.setTitle("SocialBookmarking");
		blog3.setTitle("Blog");
		sn3.setTitle("SocialNetworking");
		ss3.setTitle("SiteSearch");

		features3.add(mb);
		features3.add(fs);
		features3.add(wiki);
		features3.add(rss);
		features3.add(sb3);
		features3.add(blog3);
		features3.add(sn3);
		features3.add(ss3);
		ltool3.setFeatures(features3);

		LearningTool ltool4 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool4.setTitle("Delicious");
		ltool4
				.setToolImgURL("http://upload.wikimedia.org/wikipedia/en/thumb/d/d1/Del_icio_us.svg/150px-Del_icio_us.svg.png");

		GeneralInformation gi4 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi4
				.setDescription("Delicious is a free social bookmarking tool. Delicious enables you to  store your bookmarks online, tag them and share them with your colleagues and students.  Easy to use to search for other bookmarked resources");
		gi4.setToolURL("http://www.delicious.com");
		gi4.setToolCost(toolcost);
		gi4.setToolAvailability(ta);

		ltool4.setGeneralInfo(gi4);

		TechnicalInformation ti4 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti4.registration(true);
		ti4.setLaunchedTime("2003");

		ti4.isOpenSource(false);

		ti4.addMD(mdCls1);
		ti4.addMD(mdCls2);
		ti4.addMD(mdCls3);

		ti4.addOS(os1);
		ti4.addOS(os2);
		ti4.addOS(os3);

		ltool4.setTechnicalInfo(ti4);

		Collection<Feature> features4 = new LinkedList<Feature>();
		SiteSearch ss4 = (SiteSearch) rf.createResource(SiteSearch.class);
		SocialBookmarking sb4 = (SocialBookmarking) rf
				.createResource(SocialBookmarking.class);

		CollaborativeTagging ct4 = (CollaborativeTagging) rf
				.createResource(CollaborativeTagging.class);
		ContactList cl = (ContactList) rf.createResource(ContactList.class);
		cl.setTitle("ContactList");
		ct4.setTitle("CollaborativeTagging");
		sb4.setTitle("SocialBookmarking");
		ss4.setTitle("SiteSearch");

		features4.add(cl);
		features4.add(ct4);
		features4.add(sb4);
		features4.add(ss4);
		ltool4.setFeatures(features4);

		LearningTool ltool5 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool5.setTitle("Flickr");
		ltool5
				.setToolImgURL("http://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Flickr_wordmark.svg/200px-Flickr_wordmark.svg.png");

		GeneralInformation gi5 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi5
				.setDescription("Flickr is an image and video hosting website, web services suite, and online community");
		gi5.setToolURL("http://www.flickr.com");
		gi5.setToolCost(toolcost);
		gi5.setToolAvailability(ta);

		ltool5.setGeneralInfo(gi5);

		TechnicalInformation ti5 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti5.registration(true);
		ti5.setLaunchedTime("2004");

		ti5.isOpenSource(false);

		ti5.addMD(mdCls1);
		ti5.addMD(mdCls2);
		ti5.addMD(mdCls3);

		ti5.addOS(os1);
		ti5.addOS(os2);
		ti5.addOS(os3);

		ltool5.setTechnicalInfo(ti5);

		Collection<Feature> features5 = new LinkedList<Feature>();
		SiteSearch ss5 = (SiteSearch) rf.createResource(SiteSearch.class);
		SocialBookmarking sb5 = (SocialBookmarking) rf
				.createResource(SocialBookmarking.class);

		MultimediaHosting mh5 = (MultimediaHosting) rf
				.createResource(MultimediaHosting.class);

		mh5.setTitle("MultimediaHosting");
		sb5.setTitle("SocialBookmarking");
		ss5.setTitle("SiteSearch");

		features5.add(mh5);
		features5.add(sb5);
		features5.add(ss5);
		ltool5.setFeatures(features5);

		LearningTool ltool6 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool6.setTitle("Skype");
		ltool6
				.setToolImgURL("http://upload.wikimedia.org/wikipedia/en/thumb/6/65/Skype_logo2.svg/200px-Skype_logo2.svg.png");

		GeneralInformation gi6 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi6
				.setDescription("Skype is a software application that allows users to make voice calls over the Internet");
		gi6.setToolURL("http://www.skype.com");
		gi6.setToolCost(toolcost);
		gi6.setToolAvailability(ta2);

		ltool6.setGeneralInfo(gi6);

		TechnicalInformation ti6 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti6.registration(true);
		ti6.setLaunchedTime("2003");

		ti6.isOpenSource(false);

		ti6.addMD(mdCls1);
		ti6.addMD(mdCls2);
		ti6.addMD(mdCls3);

		ti6.addOS(os1);
		ti6.addOS(os2);
		ti6.addOS(os3);

		ltool6.setTechnicalInfo(ti6);

		Collection<Feature> features6 = new LinkedList<Feature>();

		ContactList cl6 = (ContactList) rf.createResource(ContactList.class);
		FileSharing fs6 = (FileSharing) rf.createResource(FileSharing.class);
		Voip v = (Voip) rf.createResource(Voip.class);
		InstantMessaging im6 = (InstantMessaging) rf
				.createResource(InstantMessaging.class);
		OnlineConferencing oc = (OnlineConferencing) rf
				.createResource(OnlineConferencing.class);

		oc.setTitle("OnlineConferencing");
		im6.setTitle("InstantMessaging");
		v.setTitle("Voip");
		fs6.setTitle("FileSharing");
		cl6.setTitle("ContactList");

		features6.add(cl6);
		features6.add(sb5);
		features6.add(im6);
		features6.add(oc);
		features6.add(v);
		features6.add(fs6);
		ltool6.setFeatures(features6);

		LearningTool ltool7 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool7.setTitle("Youtube");
		ltool7.setToolImgURL("http://thm-a01.yimg.com/nimage/2735b83d03d337a8");

		GeneralInformation gi7 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi7
				.setDescription("YouTube is a resource site where you can host, tag and share videos. If you want to use a video, you can either link to it on the YouTube site or embed it into a web page or blog. It is therefore a useful resource of user-generated video content");
		gi7.setToolURL("http://www.youtube.com");
		gi7.setToolCost(toolcost);
		gi7.setToolAvailability(ta);

		ltool7.setGeneralInfo(gi7);

		TechnicalInformation ti7 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti7.registration(true);
		ti7.setLaunchedTime("2005");

		ti7.isOpenSource(false);

		ti7.addMD(mdCls1);
		ti7.addMD(mdCls2);
		ti7.addMD(mdCls3);

		ti7.addOS(os1);
		ti7.addOS(os2);
		ti7.addOS(os3);

		ltool7.setTechnicalInfo(ti7);

		Collection<Feature> features7 = new LinkedList<Feature>();

		SiteSearch ss7 = (SiteSearch) rf.createResource(SiteSearch.class);
		MultimediaHosting mh7 = (MultimediaHosting) rf
				.createResource(MultimediaHosting.class);
		UserGroup ug7 = (UserGroup) rf.createResource(UserGroup.class);

		ug7.setTitle("UserGroup");
		mh7.setTitle("MultimediaHosting");
		ss7.setTitle("SiteSearch");

		features7.add(ug7);
		features7.add(mh7);
		features7.add(ss7);

		ltool7.setFeatures(features7);

		LearningTool ltool8 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool8.setTitle("Moodle");
		ltool8
				.setToolImgURL("http://moodle.com/pictures/moodle-logo-small.png");

		GeneralInformation gi8 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi8
				.setDescription("Moodle is an open source course management system (CMS) that is taking the educational world by storm.  It provides all the sophisticated high level functionality of an educational CMS and more - and there are no license fees.  More and more colleges and universities, and even businesses, are turning to Moodle to host and deliver courses online.");
		gi8.setToolURL("http://www.moodle.com");
		gi8.setToolCost(toolcost);
		gi8.setToolAvailability(ta2);

		ltool8.setGeneralInfo(gi8);

		TechnicalInformation ti8 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti8.registration(true);
		ti8.setLaunchedTime("2001");

		ti8.isOpenSource(true);

		ti8.addMD(mdCls1);
		ti8.addMD(mdCls2);
		ti8.addMD(mdCls3);

		ti8.addOS(os1);
		ti8.addOS(os2);
		ti8.addOS(os3);

		ltool8.setTechnicalInfo(ti8);

		Collection<Feature> features8 = new LinkedList<Feature>();

		ContactList cl8 = (ContactList) rf.createResource(ContactList.class);
		SiteSearch ss8 = (SiteSearch) rf.createResource(SiteSearch.class);
		MultimediaHosting mh8 = (MultimediaHosting) rf
				.createResource(MultimediaHosting.class);
		UserGroup ug8 = (UserGroup) rf.createResource(UserGroup.class);
		EducationalFeature ef8 = (EducationalFeature) rf
				.createResource(EducationalFeature.class);
		InstantMessaging im8 = (InstantMessaging) rf
				.createResource(InstantMessaging.class);

		im8.setTitle("InstantMessaging");
		ef8.setTitle("EducationalFeature");
		cl8.setTitle("ContactList");
		ug8.setTitle("UserGroup");
		mh8.setTitle("MultimediaHosting");
		ss8.setTitle("SiteSearch");

		features8.add(ug8);
		features8.add(mh8);
		features8.add(ss8);
		features8.add(im8);
		features8.add(ef8);
		features8.add(cl8);
		ltool8.setFeatures(features8);

		LearningTool ltool9 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool9.setTitle("Audacity");
		ltool9
				.setToolImgURL("http://www.c4lpt.co.uk/images/Audacity-logo-r_50pct.jpg");

		GeneralInformation gi9 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi9
				.setDescription("Audacity is free, open source software for recording and editing sounds");
		gi9.setToolURL("http://audacity.sourceforge.net/");
		gi9.setToolCost(toolcost);
		gi9.setToolAvailability(ta2);

		ltool9.setGeneralInfo(gi9);

		TechnicalInformation ti9 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti9.registration(true);
		ti9.setLaunchedTime("2000");

		ti9.isOpenSource(true);

		ti9.addMD(mdCls1);
		ti9.addMD(mdCls2);
		ti9.addMD(mdCls3);

		ti9.addOS(os1);
		ti9.addOS(os2);
		ti9.addOS(os3);

		ltool9.setTechnicalInfo(ti9);

		Collection<Feature> features9 = new LinkedList<Feature>();

		AudioCreation ac9 = (AudioCreation) rf
				.createResource(AudioCreation.class);
		ac9.setTitle("AudioCreation");

		features9.add(ac9);
		ltool9.setFeatures(features9);

		LearningTool ltool10 = (LearningTool) rf
				.createResource(LearningTool.class);
		ltool10.setTitle("Prezi");
		ltool10
				.setToolImgURL("http://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Prezi.com-logo.png/235px-Prezi.com-logo.png");

		GeneralInformation gi10 = (GeneralInformation) rf
				.createResource(GeneralInformation.class);

		gi10
				.setDescription("Prezi lets you create zooming presentations. Create a map of your ideas, images, videos, then show overview, zoom to details, amaze, convince, take the day. And it is very simple to us");
		gi10.setToolURL("http://www.prezi.com/");
		gi10.setToolCost(toolcost);
		gi10.setToolAvailability(ta);

		ltool10.setGeneralInfo(gi10);

		TechnicalInformation ti10 = (TechnicalInformation) rf
				.createResource(TechnicalInformation.class);
		ti10.registration(true);
		ti10.setLaunchedTime("2008");

		ti10.isOpenSource(false);

		ti10.addMD(mdCls1);
		ti10.addMD(mdCls2);
		ti10.addMD(mdCls3);

		ti10.addOS(os1);
		ti10.addOS(os2);
		ti10.addOS(os3);

		ltool10.setTechnicalInfo(ti10);

		Collection<Feature> features10 = new LinkedList<Feature>();

		PresentationCreation ac10 = (PresentationCreation) rf
				.createResource(PresentationCreation.class);
		ac10.setTitle("PresentationCreation");

		features10.add(ac10);
		ltool10.setFeatures(features10);

		ltools.add(ltool1);
		ltools.add(ltool2);
		ltools.add(ltool3);
		ltools.add(ltool4);
		ltools.add(ltool5);
		ltools.add(ltool6);
		ltools.add(ltool7);
		ltools.add(ltool8);
		ltools.add(ltool9);
		ltools.add(ltool10);
		// DB
		rrw.saveResources(ltools);

		Collection<LearningTool> learningtools = rrw
				.loadResourcesFromDB(LearningTool.class);
		/*
		 * LinkedList<LearningTool> list = (LinkedList<LearningTool>)
		 * learningtools;
		 * 
		 * Iterator<LearningTool> iter = list.iterator();
		 * 
		 * while (iter.hasNext()) { LearningTool t = (LearningTool) iter.next();
		 * 
		 * System.out.println(t.getToolImgURL());
		 * 
		 * }
		 */

		try {
			JSONExporter jsonexp = new JSONExporterCls();
			System.out.println(jsonexp.convertLTToJSON(learningtools));

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	/*
	 * @SuppressWarnings("unchecked") public static Collection<LearningTool>
	 * importLT(String fileName, String syntax) { RelsysResourceFactory rf = new
	 * RelsysResourceFactory();
	 * 
	 * // OntModel dataModel = ModelFactory.createOntologyModel(); Model
	 * dataModel = null; try { dataModel = ModelFactory.createDefaultModel();
	 * dataModel.setNsPrefix("lt",
	 * "http://diplomski.nelakolundzija.org/LTontology.rdf#");
	 * dataModel.setNsPrefix("swc",
	 * "http://data.semanticweb.org/ns/swc/ontology#");
	 * dataModel.setNsPrefix("jenabean", "http://thewebsemantic.com/");
	 * dataModel.setNsPrefix("dc", "http://purl.org/dc/elements/1.1/");
	 * dataModel.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#");
	 * dataModel.setNsPrefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
	 * 
	 * dataModel.read(new FileInputStream(fileName),
	 * "http://diplomski.nelakolundzija.org/LTontology.rdf#", syntax); } catch
	 * (Exception e) { logger.error("Could not load DataModel from file: " + e);
	 * }
	 * 
	 * /* dataModel.read("http://diplomski.nelakolundzija.org/individuals.owl",
	 * "RDF/XML");
	 * 
	 * ExtendedIterator<OntClass> it= dataModel.listClasses();
	 * while(it.hasNext()){ OntClass cls = it.next();
	 * System.out.println(cls.getURI()); }
	 */

	/*
	 * RDF2Bean reader = new RDF2Bean(dataModel); Collection<LearningTool>
	 * ltools = reader.loadDeep(rf
	 * .getBeanImplementationClass(LearningTool.class));
	 * 
	 * LinkedList<LearningTool> list = (LinkedList<LearningTool>) ltools;
	 * 
	 * Iterator<LearningTool> iter = list.iterator();
	 * 
	 * while (iter.hasNext()) { LearningTool t = (LearningTool) iter.next();
	 * System.out.println(t.getTitle()); } return ltools;
	 * 
	 * }
	 */

}
